<ol class='book-toc'>
  {{ range $i, $chapter := index (.Scratch.Get "book") "chapters" }}
  {{ if (and (ge $i ($.Scratch.Get "first_chapter")) (le $i ($.Scratch.Get "last_chapter"))) }}
  <li class='chapter'>
  <h2>{{ $chapter.cs_number }}. <a href="{{ relURL (replace (index (index $chapter.sections 0) "url") "?" "%3F") }}">{{ $chapter.title }}</a></h2>
    <ol>
      {{ range $section := $chapter.sections }}
        <li>
          {{ $section.cs_number }}
          <a href="{{ relURL (replace $section.url "?" "%3F") }}"{{ if (eq $section.cs_number $.Params.book.section.cs_number) }} class="active"{{ end }}>{{ $section.title }}</a>
        </li>
      {{ end }}
    </ol>
  </li>
  {{ end }}
  {{ end }}
</ol>
